package xyz.jcat.biz.member.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import xyz.jcat.biz.member.domain.dto.LoginDto;
import xyz.jcat.biz.member.domain.vo.LoginSuccessVo;
import xyz.jcat.biz.member.service.ILoginService;
import xyz.jcat.biz.member.service.IMemberService;
import xyz.jcat.common.web.Resp;

import javax.validation.Valid;

@RestController
public class LoginController {

    @Autowired
    private IMemberService memberService;
    @Autowired
    private ILoginService loginService;

    @PostMapping("/login")
    public Resp login(@Valid @RequestBody LoginDto loginDto) {
        LoginSuccessVo vo = loginService.login(loginDto);
        return Resp.ok(vo);
    }
}
